{% if current_user.is_authenticated %}
<div class="panel panel-default">
	<div class="panel-body">
		<div class="row">
			<div class="col-xs-12">
				<img src="{{ url_for('static',filename='user/avatar/'+current_user.avatar) }}" class="img-circle center-block" style="width: 80px;height: 80px;"></div>
			<div class="col-xs-12" style="margin-top: 10px;">
				<p class="user-name text-center">{{ current_user.username }}</p>
				{% if current_user.abortme %}
				<p class="user-about text-center">{{ current_user.abortme }}</p>
				{% endif %}
			</div>
		</div>
		<div class="row" style="margin: 0 0 0 0;">
			<ul class="nav nav-pills">
			<li class="col-xs-4" style="margin: 0 0 0 0;">
				<a href="{{ url_for('main.user_index',id=current_user.id) }}" data-toggle="tooltip"  title="主页"><img src="{{ url_for('static',filename='icon/home-icon.png') }}" class="center-block" style="height: 30px;width: 30px;"></a> 
			</li>
			<li class="col-xs-4" style="margin: 0 0 0 0;">
				<a href="{{ url_for('main.user_seting') }}" data-toggle="tooltip"  title="设置"><img src="{{ url_for('static',filename='icon/settings-3-icon.png') }}" class="center-block" style="height: 30px;width: 30px;"></a> 
			</li>
			<li class="col-xs-4" style="margin: 0 0 0 0;">
				<a href="{{ url_for('auth.user_logout') }}" data-toggle="tooltip"  title="登出"><img src="{{ url_for('static',filename='icon/close-icon.png') }}" class="center-block" style="height: 30px;width: 30px;"></a> 
			</li>
			</ul>
		</div>
	</div>
	<div class="panel-footer">
		<a href="{{ url_for('main.messages') }}"><p class="message" style="margin: 0px">站内消息 {% if current_user.noread_messages > 0 %}<span class="badge" style="background-color: #FF3300;">{{ current_user.noread_messages }}</span>{% endif %}</p></a>
	</div>
</div>
{% endif %}
{% if data %}
<div class="panel panel-info">
	<div class="panel-heading">
		<h3 class="panel-title">
			网站统计
		</h3>
	</div>
	<div class="panel-body">
		<p><span class="glyphicon glyphicon-user" style="color: #99CCCC;"></span> 会员：<span class="badge">{{ data['uc'] }}</span></p> 
		<p><span class="glyphicon glyphicon-folder-open" style="color: #99CCCC;"></span> 文章：<span class="badge">{{ data['pc'] }}</span></p> 
		<p><span class="glyphicon glyphicon-question-sign" style="color: #99CCCC;"></span> 问题：<span class="badge">{{ data['qc'] }}</span></p> 
		<p><span class="glyphicon glyphicon-ok-sign" style="color: #99CCCC;"></span> 回答：<span class="badge">{{ data['ac'] }}</span></p> 
		<p><span class="glyphicon glyphicon-comment" style="color: #99CCCC;"></span> 评论：<span class="badge">{{ data['cc'] }}</span></p> 
	</div>
</div>
{% endif %}
<div class="panel panel-primary">
	<div class="panel-heading">
		<h3 class="panel-title">
			文章标签
		</h3>
	</div>
	<div class="panel-body">
		{% for tag in tags %}
		{% set color = random.choice(['default','primary','info']) %}
		{% set size = random.choice(['sm','xs']) %}
		<a href="{{ url_for('main.post_for_tag',tag=tag.id)}}"><button type="button" class="btn btn-{{ color }} btn-{{ size }}" style="margin-bottom: 4px;">{{ tag.tag_name }} {% if tag.posts.count() != 0 %}<span class="badge" style="font-size: 6px;">{{ tag.posts.count() }}</span>{% endif %}</button></a>
		{% endfor %}
	</div>
</div>

<div class="panel panel-primary col-lg-12">
    <div class="panel-heading">
        <h3 class="panel-title">
            问答区动态
        </h3>
    </div>
    <ul class="list-group">
        {% for q in questions %}
        <li class="list-group-item">
            <p class="list-meta">
            <a href="{{ url_for('main.question',id=q.id) }}">{{ q.title }}</a>
            </p>
        </li>
        {% endfor %}
    </ul>
</div>

<div class="panel panel-primary col-lg-12" id="footer">
	<div class="panel-body">
        <p class="text-center col-xs-12">
            <a href="mailto:simonzhoup@gmail.com" style="color:#222; margin-left: 3px;margin-right: 3px;"><span class="glyphicon glyphicon-envelope"></span></a> /
            <a style="color: #222; margin-left: 3px;margin-right: 3px;"><span class="glyphicon glyphicon-qrcode" data-toggle="popover" data-placement="bottom" id='weixin'></span></a> /
            <a href="https://github.com/simonzhoup" style="margin-left: 3px;margin-right: 3px;"><img src="{{ url_for('static',filename='icon/github.ico') }}" height="16" width="16" style="margin-top: 1px;position: absolute;"></a>
        </p>
        <p class="text-center col-xs-12" style="margin-bottom: 5px;"> Powered By <a href="http://flask.pocoo.org/">Flask</a> </p>
        <p class="text-center col-xs-12" style="margin-bottom: 5px;"> copyright by <a href="mailto:simonzhoup@gmail.com">simonzhoup</a></p>
    </div>
	<script>
    $('#weixin').popover({
        trigger : 'hover',//鼠标以上时触发弹出提示框
        html:true,//开启html 为true的话，data-content里就能放html代码了
        content:'<img src="{{ url_for('static',filename='icon/wechat.jpg') }}">'
    });
	</script>
</div>

